package com.spring.mybatis.anno.dao;


import java.util.List;

import org.apache.ibatis.annotations.*;

import com.spring.mybatis.anno.po.Car;


public interface CarDao {

  @Select("select * from t_car where id=#{id}")
  Car selectById(String id);

  @Select("select * from t_car")
  List<Car> selectAll();

  @Select("select * from t_car where name=#{carname}")
  Car selectBycarName(String carname);

  @Insert("insert into t_car (id,name,color) values(#{id},#{name},#{color})")
  @Options(useGeneratedKeys = true, keyColumn = "id") // 获取自增的id
  void insert(Car car);

  @Update("update t_car set color = #{color} where id=#{id}")
  int update(Car car);

  @Delete(" delete from t_car where id=#{id}")
  int deleteById(Long id);
}
